var formatDate = function (date, fmt) {
    var date = new Date(date.replace(/-/g, '/'));
    switch (fmt) {
        case 'yyyyMMdd':
            var year = date.getFullYear();
            var month = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : '' + (date.getMonth() + 1);
            var day = date.getDate() < 10 ? '0' + date.getDate() : '' + date.getDate();
            return year + '' + month + '' + day;
            break;
        case 'yyMMdd':
            var year = date.getFullYear();
            var yearstr = year + '';
            var yearshort = yearstr.substring(2);
            var month = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : '' + (date.getMonth() + 1);
            var day = date.getDate() < 10 ? '0' + date.getDate() : '' + date.getDate();
            return yearshort + '' + month + '' + day;
            break;
        case 'yy-MM-dd':
            var year = date.getFullYear();
            var yearstr = year + '';
            var yearshort = yearstr.substring(2);
            var month = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : '' + (date.getMonth() + 1);
            var day = date.getDate() < 10 ? '0' + date.getDate() : '' + date.getDate();
            return yearshort + '-' + month + '-' + day;
            break;
        case 'yyyy-MM-dd':
            var year = date.getFullYear();
            var month = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : '' + (date.getMonth() + 1);
            var day = date.getDate() < 10 ? '0' + date.getDate() : '' + date.getDate();
            return year + '-' + month + '-' + day;
            break;
    }
    return fmt
}
export default formatDate
